package com.nettest.pojo;

import java.util.List;

public class Page implements java.io.Serializable {

	private static final long serialVersionUID = 8118407252235874424L;

	public void setPageProperty(Page page) {
		if (page.getStart() > 0) {
			// 设置取数据的区间
			int endPage = page.getStart() + page.getLimit();
			int stratPage = page.getStart();
			this.setStart(stratPage);
			this.setLimit(endPage);
		} else {
			this.setLimit(page.getLimit());
			this.setStart(0);
		}
		if(page.getLimit() == 0) {
			this.setLimit(page.getTotalProperty());
		}
	}

	/** 总记录数 */
	private int totalProperty;

	/** 分页结果 */
	private List<?> root;

	/** 开始页码 */
	private int start;

	/** 每页多少 */
	private int limit;

	/** 成功与否 */
	private boolean success;

	/** 查询条件 */
	private Object objCondition;
	/** 排序字段 */
	private String sortField;
	/** 排序 */
	private String descOrAsc = "asc";

	public int getTotalProperty() {
		return totalProperty;
	}

	public void setTotalProperty(int totalProperty) {
		this.totalProperty = totalProperty;
	}

	public List<?> getRoot() {
		return root;
	}

	public void setRoot(List<?> root) {
		this.root = root;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getLimit() {
		return limit;
	}

	public void setLimit(int limit) {
		this.limit = limit;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public Object getObjCondition() {
		return objCondition;
	}

	public void setObjCondition(Object objCondition) {
		this.objCondition = objCondition;
	}

	public String getSortField() {
		return sortField;
	}

	public void setSortField(String sortField) {
		this.sortField = sortField;
	}

	public String getDescOrAsc() {
		return descOrAsc;
	}

	public void setDescOrAsc(String descOrAsc) {
		this.descOrAsc = descOrAsc;
	}
}
